/**
 */
package usixmlcui.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;

import usixmlcui.ConcreteInteractionUnit;
import usixmlcui.ConcreteStyle;
import usixmlcui.InteractionUnitState;
import usixmlcui.Usixml_cuiPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Concrete Interaction Unit</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link usixmlcui.impl.ConcreteInteractionUnitImpl#getId <em>Id</em>}</li>
 *   <li>{@link usixmlcui.impl.ConcreteInteractionUnitImpl#getLabel <em>Label</em>}</li>
 *   <li>{@link usixmlcui.impl.ConcreteInteractionUnitImpl#getLongLabel <em>Long Label</em>}</li>
 *   <li>{@link usixmlcui.impl.ConcreteInteractionUnitImpl#getShortLabel <em>Short Label</em>}</li>
 *   <li>{@link usixmlcui.impl.ConcreteInteractionUnitImpl#getInteractionUnit <em>Interaction Unit</em>}</li>
 *   <li>{@link usixmlcui.impl.ConcreteInteractionUnitImpl#getHelp <em>Help</em>}</li>
 *   <li>{@link usixmlcui.impl.ConcreteInteractionUnitImpl#isContextCondition <em>Context Condition</em>}</li>
 *   <li>{@link usixmlcui.impl.ConcreteInteractionUnitImpl#getState <em>State</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ConcreteInteractionUnitImpl extends EObjectImpl implements ConcreteInteractionUnit {
	/**
	 * The default value of the '{@link #getId() <em>Id</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getId()
	 * @generated
	 * @ordered
	 */
	protected static final int ID_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getId() <em>Id</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getId()
	 * @generated
	 * @ordered
	 */
	protected int id = ID_EDEFAULT;

	/**
	 * The default value of the '{@link #getLabel() <em>Label</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLabel()
	 * @generated
	 * @ordered
	 */
	protected static final String LABEL_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getLabel() <em>Label</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLabel()
	 * @generated
	 * @ordered
	 */
	protected String label = LABEL_EDEFAULT;

	/**
	 * The default value of the '{@link #getLongLabel() <em>Long Label</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLongLabel()
	 * @generated
	 * @ordered
	 */
	protected static final String LONG_LABEL_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getLongLabel() <em>Long Label</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLongLabel()
	 * @generated
	 * @ordered
	 */
	protected String longLabel = LONG_LABEL_EDEFAULT;

	/**
	 * The default value of the '{@link #getShortLabel() <em>Short Label</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getShortLabel()
	 * @generated
	 * @ordered
	 */
	protected static final String SHORT_LABEL_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getShortLabel() <em>Short Label</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getShortLabel()
	 * @generated
	 * @ordered
	 */
	protected String shortLabel = SHORT_LABEL_EDEFAULT;

	/**
	 * The cached value of the '{@link #getInteractionUnit() <em>Interaction Unit</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getInteractionUnit()
	 * @generated
	 * @ordered
	 */
	protected EList interactionUnit;

	/**
	 * The default value of the '{@link #getHelp() <em>Help</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getHelp()
	 * @generated
	 * @ordered
	 */
	protected static final String HELP_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getHelp() <em>Help</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getHelp()
	 * @generated
	 * @ordered
	 */
	protected String help = HELP_EDEFAULT;

	/**
	 * The default value of the '{@link #isContextCondition() <em>Context Condition</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #isContextCondition()
	 * @generated
	 * @ordered
	 */
	protected static final boolean CONTEXT_CONDITION_EDEFAULT = false;

	/**
	 * The cached value of the '{@link #isContextCondition() <em>Context Condition</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #isContextCondition()
	 * @generated
	 * @ordered
	 */
	protected boolean contextCondition = CONTEXT_CONDITION_EDEFAULT;

	/**
	 * The default value of the '{@link #getState() <em>State</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getState()
	 * @generated
	 * @ordered
	 */
	protected static final InteractionUnitState STATE_EDEFAULT = InteractionUnitState.INACTIVE_LITERAL;

	/**
	 * The cached value of the '{@link #getState() <em>State</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getState()
	 * @generated
	 * @ordered
	 */
	protected InteractionUnitState state = STATE_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ConcreteInteractionUnitImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EClass eStaticClass() {
		return Usixml_cuiPackage.Literals.CONCRETE_INTERACTION_UNIT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getId() {
		return id;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setId(int newId) {
		int oldId = id;
		id = newId;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__ID, oldId, id));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getLabel() {
		return label;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLabel(String newLabel) {
		String oldLabel = label;
		label = newLabel;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__LABEL, oldLabel, label));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getLongLabel() {
		return longLabel;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLongLabel(String newLongLabel) {
		String oldLongLabel = longLabel;
		longLabel = newLongLabel;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__LONG_LABEL, oldLongLabel, longLabel));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getShortLabel() {
		return shortLabel;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setShortLabel(String newShortLabel) {
		String oldShortLabel = shortLabel;
		shortLabel = newShortLabel;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__SHORT_LABEL, oldShortLabel, shortLabel));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList getInteractionUnit() {
		if (interactionUnit == null) {
			interactionUnit = new EObjectWithInverseResolvingEList.ManyInverse(ConcreteStyle.class, this, Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__INTERACTION_UNIT, Usixml_cuiPackage.CONCRETE_STYLE__CONCRETE_STYLE);
		}
		return interactionUnit;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getHelp() {
		return help;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setHelp(String newHelp) {
		String oldHelp = help;
		help = newHelp;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__HELP, oldHelp, help));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isContextCondition() {
		return contextCondition;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setContextCondition(boolean newContextCondition) {
		boolean oldContextCondition = contextCondition;
		contextCondition = newContextCondition;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__CONTEXT_CONDITION, oldContextCondition, contextCondition));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public InteractionUnitState getState() {
		return state;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setState(InteractionUnitState newState) {
		InteractionUnitState oldState = state;
		state = newState == null ? STATE_EDEFAULT : newState;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__STATE, oldState, state));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public void setNewState(InteractionUnitState InteractoinUnitState) {
		this.setState(InteractoinUnitState);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__INTERACTION_UNIT:
				return ((InternalEList)getInteractionUnit()).basicAdd(otherEnd, msgs);
		}
		return super.eInverseAdd(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__INTERACTION_UNIT:
				return ((InternalEList)getInteractionUnit()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__ID:
				return new Integer(getId());
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__LABEL:
				return getLabel();
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__LONG_LABEL:
				return getLongLabel();
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__SHORT_LABEL:
				return getShortLabel();
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__INTERACTION_UNIT:
				return getInteractionUnit();
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__HELP:
				return getHelp();
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__CONTEXT_CONDITION:
				return isContextCondition() ? Boolean.TRUE : Boolean.FALSE;
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__STATE:
				return getState();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__ID:
				setId(((Integer)newValue).intValue());
				return;
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__LABEL:
				setLabel((String)newValue);
				return;
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__LONG_LABEL:
				setLongLabel((String)newValue);
				return;
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__SHORT_LABEL:
				setShortLabel((String)newValue);
				return;
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__INTERACTION_UNIT:
				getInteractionUnit().clear();
				getInteractionUnit().addAll((Collection)newValue);
				return;
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__HELP:
				setHelp((String)newValue);
				return;
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__CONTEXT_CONDITION:
				setContextCondition(((Boolean)newValue).booleanValue());
				return;
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__STATE:
				setState((InteractionUnitState)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eUnset(int featureID) {
		switch (featureID) {
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__ID:
				setId(ID_EDEFAULT);
				return;
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__LABEL:
				setLabel(LABEL_EDEFAULT);
				return;
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__LONG_LABEL:
				setLongLabel(LONG_LABEL_EDEFAULT);
				return;
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__SHORT_LABEL:
				setShortLabel(SHORT_LABEL_EDEFAULT);
				return;
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__INTERACTION_UNIT:
				getInteractionUnit().clear();
				return;
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__HELP:
				setHelp(HELP_EDEFAULT);
				return;
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__CONTEXT_CONDITION:
				setContextCondition(CONTEXT_CONDITION_EDEFAULT);
				return;
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__STATE:
				setState(STATE_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__ID:
				return id != ID_EDEFAULT;
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__LABEL:
				return LABEL_EDEFAULT == null ? label != null : !LABEL_EDEFAULT.equals(label);
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__LONG_LABEL:
				return LONG_LABEL_EDEFAULT == null ? longLabel != null : !LONG_LABEL_EDEFAULT.equals(longLabel);
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__SHORT_LABEL:
				return SHORT_LABEL_EDEFAULT == null ? shortLabel != null : !SHORT_LABEL_EDEFAULT.equals(shortLabel);
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__INTERACTION_UNIT:
				return interactionUnit != null && !interactionUnit.isEmpty();
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__HELP:
				return HELP_EDEFAULT == null ? help != null : !HELP_EDEFAULT.equals(help);
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__CONTEXT_CONDITION:
				return contextCondition != CONTEXT_CONDITION_EDEFAULT;
			case Usixml_cuiPackage.CONCRETE_INTERACTION_UNIT__STATE:
				return state != STATE_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (id: ");
		result.append(id);
		result.append(", label: ");
		result.append(label);
		result.append(", longLabel: ");
		result.append(longLabel);
		result.append(", shortLabel: ");
		result.append(shortLabel);
		result.append(", help: ");
		result.append(help);
		result.append(", contextCondition: ");
		result.append(contextCondition);
		result.append(", state: ");
		result.append(state);
		result.append(')');
		return result.toString();
	}

} //ConcreteInteractionUnitImpl
